<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script type="text/javascript" src="../js/vue.js"></script>
  <title>分析生命周期</title>
</head>
<body>
  <div id="root">
    <h2>当前的n的值是：{{n}}</h2>
    <button @click="add">点我n+1</button>
  </div>
  <script type="text/javascript">
    new Vue({
      el:'#root',
      data:{
        n:1,
      },
      methods:{
        add(){
          this.n++;
        }
      }
    })
  </script>
</body>
</html>